package com.zsc.projectmanagementapi.controller;

import com.zsc.projectmanagementapi.commons.ServerResponse;
import com.zsc.projectmanagementapi.service.Impl.AnalysisServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author Bernie_fang
 * @Description:
 * @create 2021/6/19 15:50
 **/
@RestController
public class AnalysisController {

    @Autowired
    private AnalysisServiceImpl analysisService;

    /**
     * @Description: 获取为完成的所有项目
     * @Author: Bernie_fang
     * @Since: 2021/6/19 16:38
     * @return: com.zsc.projectmanagementapi.commons.ServerResponse
     **/
    @GetMapping("/getAllUnFinishProject")
    public ServerResponse getAllUnFinishProject() {
        return analysisService.getAllUnFinishProject();
    }

    @GetMapping("/getProjectIncome")
    public ServerResponse getProjectIncome() {
        return analysisService.getProjectIncome();
    }

    @PostMapping("/portProjectIncome")
    public ServerResponse portProjectIncome(@RequestBody String ids) {
        ids = ids.substring(8, ids.length() -3);
        return analysisService.postProjectIncome(ids);
    }

    @GetMapping("/getCompletion")
    public ServerResponse getCompletion() {
        return analysisService.getCompletion();
    }


}
